package model

import (
	"fmt"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

var err error
var DB *gorm.DB

func Init() {
	dsn := "root:4ay1nkal3u8ed77y@tcp(115.190.117.4:3306)/1020rk?charset=utf8mb4&parseTime=True&loc=Local"
	DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
	if err != nil {
		panic(err)
	}
	fmt.Println("连接成功")
	DB.AutoMigrate(&Doc{})
	fmt.Println("迁移成功")
}
